#ifndef __BMP_H__
#define __BMP_H__

#pragma pack(1)

#include "color.h"
#include "ref.h"

#define BUF 1024

typedef struct {
    uint16_t bfType;
    uint32_t bfSize;
    uint16_t bfReserved1;
    uint16_t bfReserved2;
    uint32_t bfOffBits;
} BMPFileHeader;

typedef struct {
    uint32_t biSize;
    uint32_t biWidth;
    uint32_t biHeight;
    uint16_t biPlanes;
    uint16_t biBitCount;
    uint32_t biCompression;
    uint32_t biSizeImage;
    uint32_t biXPelsPerMeter;
    uint32_t biYPelsPerMeter;
    uint32_t biClrUsed;
    uint32_t biClrImportant;
} BMPInfoHeader;

typedef struct {
    uint32_t width;
    uint32_t height;
    uint32_t bitCount;
    Color* entry;
} BMP;

BMP readBMP(const char* filename);

#endif /* __BMP_H__ */
